import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';

@Injectable({ providedIn: 'root' })
export class RuKuService {
  constructor(private http: HttpClient) {}

  // 分页条件查询（只传有值的参数）
  getRuKuList(params: any): Observable<any> {
    const queryParams: any = {
      Sorting: params.Sorting || '',
      SkipCount: params.SkipCount,
      MaxResultCount: params.MaxResultCount
    };
    return this.http.get('/api/app/ru-ku', { params: queryParams });
  }

  // 获取所有仓库（分页+模糊搜索）
  getStorehouseList(params: any): Observable<any> {
    // 新接口
    return this.http.get('/api/app/ru-ku/storehouse-dto', { params });
  }

  // 获取所有关联单号（分页+模糊搜索）
  getConnectNoList(params: any): Observable<any> {
    // 如有真实接口请替换
    return this.http.get('/api/app/connect-from', { params });
  }

  // 获取入库类型枚举
  getRuTypeEnum(): Observable<any> {
    return this.http.get('/api/app/ru-ku/type');
  }

  // 获取状态枚举
  getRuStatusEnum(): Observable<any> {
    return this.http.get('/api/app/ru-ku/status-dto');
  }

  // 按条件查询入库单
  getRuKuListByCondition(params: any): Observable<any> {
    return this.http.get('/api/app/ru-ku/by-condition-ru-ku-query', { params });
  }
} 